<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>

<%@page import="java.util.*,model.*"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>



	<%
		Applicant applicant = (Applicant) session.getAttribute("applicant");
		Vector locationsVector = (Vector) session
				.getAttribute("locationsVector");
		Degree degree = (Degree) session.getAttribute("degree");
		Vector degreesVector = (Vector) session
				.getAttribute("degreeVector");
		String degreesString = Database.printDegrees(degreesVector);
		String location;
		if(request.getParameter("location")!= null){
			location = request.getParameter("location");
			degree.setCountry(location);
		}else{
			location = request.getParameter("state");
		}
		if (location.equals("United States")) {
			session.setAttribute("degree", degree);
			%>
					<logic:redirect	href="/StrutsCSE135/pages/students/degrees_location.jsp?state=true" />
			<%;}%>

	<logic:present parameter="state">
		<%
			location = request.getParameter("state");
			degree.setState(location);
		%>
	</logic:present>
	<%Vector universitiesVector = Database.getUniversitiesAtLocation(location);
	session.setAttribute("degree", degree);
	%>
	<%="Name: " + applicant.getName()%><br />
	<%="Country of Citizenship: " + applicant.getCitizenship()%>
	<br />
	<%="Country of Residence: "
					+ applicant.getCountry_of_residence()%><br />
	<%
		if (applicant.isDomestic()) {
	%>
	<%="Address: " + applicant.getAddressDomestic()%><br />
	<%
		} else {
	%>
	<%="Address: " + applicant.getAddressForeign()%><br />
	<%
		}
	%>
	<%=applicant.getDomestic()%><br />
	<br />

	<!-- Print Degrees -->
	<%
		out.println("<strong> Current Degree </strong> ");
	%>
	<br />
	<%= "Degree-Country: " + degree.getCountry() %><br/>
	<%if(degree.hasState())
				out.println("Degree-State: " + degree.getState());
	%>
	<br/>

	<hr />
	<br /> Please select what university you have degrees from:
	<br />
	<br />

	<table>
		<tr>
			<td>
				<%
					int count = universitiesVector.size();
					for (int i = 0; i < count / 3; i++) {
						out.println("<a href=\"/StrutsCSE135/pages/students/degrees_discipline.jsp?university="
								+ universitiesVector.get(i)
								+ "\">"
								+ universitiesVector.get(i) + "</a>");
						out.println("<br />");
					}
				%>
			</td>
			<td>
				<%
					for (int i = count / 3; i < (count / 3) * 2 + 1; i++) {
						out.println("<a href=\"/StrutsCSE135/pages/students/degrees_discipline.jsp?university="
								+ universitiesVector.get(i)
								+ "\">"
								+ universitiesVector.get(i) + "</a>");
						out.println("<br />");
					}
				%>
			</td>
			<td>
				<%
					for (int i = (count / 3) * 2; i < count; i++) {
						out.println("<a href=\"/StrutsCSE135/pages/students/degrees_discipline.jsp?university="
								+ universitiesVector.get(i)
								+ "\">"
								+ universitiesVector.get(i) + "</a>");
						out.println("<br />");
					}
				%>
			</td>
		</tr>
	</table>
</body>
</html>